<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: banner_manager.php 18 2013-09-21 11:52:50Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 18 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 11:52:50 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

require('includes/application_top.php');

$banner_extension = banner_image_extension();

if ($_GET['action']) {
	switch ($_GET['action']) {
		case 'setflag':
		if(($_GET['flag'] == '0') || ($_GET['flag'] == '1')) {
			set_banner_status($_GET['bID'], $_GET['flag']);
			$message_stack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success');
		} else
			$message_stack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error');

        redirect(href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.(int)$_GET['bID']));
        break;

      case 'insert':
      case 'update':
        $banners_id = $_POST['banners_id'];
        $banners_title = $_POST['banners_title'];
        $banners_url = $_POST['banners_url'];
        $new_banners_group = $_POST['new_banners_group'];
        $banners_group = 'BANNER';
        $html_text = $_POST['html_text'];
        $banners_image_local = $_POST['banners_image_local'];
        $banners_image_target = $_POST['banners_image_target'];
        $db_image_location = '';

        $banner_error = false;
        if (empty($banners_title)) {
          $message_stack->add(ERROR_BANNER_TITLE_REQUIRED, 'error');
          $banner_error = true;
        }

        if (empty($banners_group)) {
          $message_stack->add(ERROR_BANNER_GROUP_REQUIRED, 'error');
          $banner_error = true;
        }

        if (empty($html_text)) {
          if (!$banners_image = &try_upload('banners_image', DIR_FS_CATALOG_IMAGES.'banner/'.$banners_image_target) && $_POST['banners_image_local'] == '')
            $banner_error = true;
        }

        if (!$banner_error) {
          $db_image_location = (not_null($banners_image_local) ? $banners_image_local : ($banners_image_target.$banners_image->filename));
          $sql_data_array = array('banners_title' => $banners_title,
                                  'banners_url' => $banners_url,
                                  'banners_image' => $db_image_location,
                                  'banners_group' => $banners_group,
                                  'banners_html_text' => $html_text);

          if ($_GET['action'] == 'insert') {
            $insert_sql_data = array('date_added' => 'NOW()',
                                      'status' => '1');
            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
            $db->db_perform(TABLE_BANNERS, $sql_data_array);
            $banners_id = $db->db_insert_id();
            $message_stack->add_session(SUCCESS_BANNER_INSERTED, 'success');

          } elseif ($_GET['action'] == 'update') {
            $db->db_perform(TABLE_BANNERS, $sql_data_array, 'update', 'banners_id = \''.$banners_id.'\'');
            $message_stack->add_session(SUCCESS_BANNER_UPDATED, 'success');
          }

          if ($_POST['expires_date']) {
            $expires_date = $_POST['expires_date'];

            $db->db_query("UPDATE ".TABLE_BANNERS." set expires_date = ".$db->db_prepare($expires_date).", expires_impressions = null WHERE banners_id = '".$banners_id."'");

          } elseif ($_POST['impressions']) {
            $impressions = ($_POST['impressions']);
            $db->db_query("UPDATE ".TABLE_BANNERS." set expires_impressions = ".$db->db_prepare($impressions).", expires_date = null WHERE banners_id = '".$banners_id."'");
          }

          if (isset($_POST['date_scheduled']) && !empty($_POST['date_scheduled'])) {
            $date_scheduled = $_POST['date_scheduled'];
            $db->db_query("UPDATE ".TABLE_BANNERS." set date_scheduled = ".$db->db_prepare($date_scheduled).", status = '0' where banners_id = '".$banners_id."'");
          }

          redirect(href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$banners_id));
        } else {
          $_GET['action'] = 'new';
        }
        break;

      case 'deleteconfirm':
        $banners_id = ($_GET['bID']);
        $delete_image = ($_POST['delete_image']);

        if ($delete_image == 'on') {
          $banner = $db->db_query("SELECT banners_image from ".TABLE_BANNERS." WHERE banners_id = ".$db->db_prepare($banners_id));


          if (is_file(DIR_FS_CATALOG_IMAGES.$banner->fields['banners_image'])) {
            if (is_writeable(DIR_FS_CATALOG_IMAGES.$banner->fields['banners_image'])) {
              unlink(DIR_FS_CATALOG_IMAGES.$banner->fields['banners_image']);
            } else {
              $message_stack->add_session(ERROR_IMAGE_IS_NOT_WRITEABLE, 'error');
            }
          } else {
            $message_stack->add_session(ERROR_IMAGE_DOES_NOT_EXIST, 'error');
          }
        }

        $db->db_query("DELETE FROM ".TABLE_BANNERS." WHERE banners_id = ".$db->db_prepare($banners_id));
        $db->db_query("DELETE FROM ".TABLE_BANNERS_HISTORY." WHERE banners_id = ".$db->db_prepare($banners_id));

        if((function_exists('imagecreate')) && ($banner_extension) ) {
          if(is_file(DIR_WS_IMAGES.'graphs/banner_infobox-'.$banners_id.'.'.$banner_extension)) {
            if(is_writeable(DIR_WS_IMAGES.'graphs/banner_infobox-'.$banners_id.'.'.$banner_extension)) {
              unlink(DIR_WS_IMAGES.'graphs/banner_infobox-'.$banners_id.'.'.$banner_extension);
            }
          }

          if (is_file(DIR_WS_IMAGES.'graphs/banner_yearly-'.$banners_id.'.'.$banner_extension)) {
            if (is_writeable(DIR_WS_IMAGES.'graphs/banner_yearly-'.$banners_id.'.'.$banner_extension)) {
              unlink(DIR_WS_IMAGES.'graphs/banner_yearly-'.$banners_id.'.'.$banner_extension);
            }
          }

          if (is_file(DIR_WS_IMAGES.'graphs/banner_monthly-'.$banners_id.'.'.$banner_extension)) {
            if (is_writeable(DIR_WS_IMAGES.'graphs/banner_monthly-'.$banners_id.'.'.$banner_extension)) {
              unlink(DIR_WS_IMAGES.'graphs/banner_monthly-'.$banners_id.'.'.$banner_extension);
            }
          }

          if (is_file(DIR_WS_IMAGES.'graphs/banner_daily-'.$banners_id.'.'.$banner_extension)) {
            if (is_writeable(DIR_WS_IMAGES.'graphs/banner_daily-'.$banners_id.'.'.$banner_extension)) {
              unlink(DIR_WS_IMAGES.'graphs/banner_daily-'.$banners_id.'.'.$banner_extension);
            }
          }
        }

        $message_stack->add_session(SUCCESS_BANNER_REMOVED, 'success');

        redirect(href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page']));
        break;
    }
  }

// check if the graphs directory exists
  $dir_ok = false;
  if((function_exists('imagecreate')) && ($banner_extension) ) {
    if(is_dir(DIR_WS_IMAGES.'graphs')) {
      if(is_writeable(DIR_WS_IMAGES.'graphs'))
        $dir_ok = true;
      else
        $message_stack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error');

    } else {
      $message_stack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error');
    }
  }
require(DIR_WS_INCLUDES.'metatag.php'); ?>
<script type="text/javascript"><!--
function popupImageWindow(url) {
  window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//-->
</script>
</head>
<body>
<div id="spiffycalendar" class="text"></div>
<?php require(DIR_WS_INCLUDES.'header.php'); ?>
<div id="wrapper">
<table class="outerTable" cellspacing="0" cellpadding="0">
  <tr>
    <td class="columnLeft2" width="<?php echo BOX_WIDTH; ?>" valign="top">
<?php require(DIR_WS_INCLUDES.'column_left.php'); ?>
</td>
    <td class="boxCenter" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td><table class="table_pageHeading" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
          </tr>
        </table></td>
      </tr>
<?php
  if ($_GET['action'] == 'new') {
    $form_action = 'insert';
    if ($_GET['bID']) {
      $bID = ($_GET['bID']);
      $form_action = 'update';

      $banner = $db->db_query("	SELECT 
									banners_title, 
									banners_url, 
									banners_image, 
									banners_group, 
									banners_html_text, 
									status, 
									date_format(date_scheduled, '%d.%m.%Y') as date_scheduled, 
									date_format(expires_date, '%d.%m.%Y') as expires_date, 
									date_format(date_scheduled, '%Y-%m-%d') as date_scheduled_input, 
									date_format(expires_date, '%Y-%m-%d') as expires_date_input, 
									expires_impressions, 
									date_status_change 
								FROM 
									".TABLE_BANNERS." 
								WHERE 
									banners_id = '".$bID."'");

      $bInfo = new objectInfo($banner->fields);
    } elseif ($_POST)
      $bInfo = new objectInfo($_POST);
    else
      $bInfo = new objectInfo(array());

    $groups_array = array();
    $groups = $db->db_query("SELECT distinct banners_group from ".TABLE_BANNERS." ORDER BY banners_group");
    while(!$groups->EOF) {
      $groups_array[] = array('id' => $groups->fields['banners_group'], 'text' => $groups->fields['banners_group']);
      $groups->MoveNext();
    }
?>
     <tr>
        <td>&nbsp;</td>
      </tr>
      <tr><?php echo draw_form('new_banner', FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&action='.$form_action, 'post', 'enctype="multipart/form-data"'); 
		if ($form_action == 'update') 
			echo draw_hidden_field('banners_id', $bID); ?>
        <td><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><?php echo TEXT_BANNERS_TITLE; ?></td>
            <td class="main"><?php echo draw_input_field('banners_title', $bInfo->banners_title, '', true); ?></td>
          </tr>
          <tr>
            <td class="main"><?php echo TEXT_BANNERS_URL; ?></td>
            <td class="main"><?php echo draw_input_field('banners_url', $bInfo->banners_url); ?></td>
          </tr>
          <tr>
            <td class="main" valign="top"><?php echo TEXT_BANNERS_GROUP; ?></td>
            <td class="main"><?php echo draw_input_field('new_banners_group', 'BANNER', 'READONLY', ((sizeof($groups_array) > 0) ? false : true)); ?></td>
          </tr>
          <tr>
            <td colspan="2">&nbsp;</td>
          </tr>
          <tr>
            <td class="main" valign="top"><?php echo TEXT_BANNERS_IMAGE; ?></td>
            <td class="main"><?php echo draw_file_field('banners_image').' '.TEXT_BANNERS_IMAGE_LOCAL.'<br />'.DIR_FS_CATALOG_IMAGES.'banner/'.draw_input_field('banners_image_local', $bInfo->banners_image); ?></td>
          </tr>
          <tr>
            <td colspan="2">&nbsp;</td>
          </tr>
          <tr>
            <td class="main"><?php echo TEXT_BANNERS_IMAGE_TARGET; ?></td>
            <td class="main"><?php echo DIR_FS_CATALOG_IMAGES.'banner/'.draw_input_field('banners_image_target'); ?></td>
          </tr>
          <tr>
            <td colspan="2">&nbsp;</td>
          </tr>
          <tr>
            <td valign="top" class="main"><?php echo TEXT_BANNERS_HTML_TEXT; ?></td>
            <td class="main"><?php echo draw_textarea_field('html_text', 'soft', '60', '5', $bInfo->banners_html_text); ?></td>
          </tr>
          <tr>
            <td colspan="2">&nbsp;</td>
          </tr>
          <tr>
            <td class="main"><?php echo TEXT_BANNERS_SCHEDULED_AT; ?></td>
            <td valign="top" class="main">
				<input type="text" name="date_scheduled" class="datepicker_1" value="<?php echo $banner->fields['date_scheduled_input']; ?>" />
				<script type="text/javascript">
					$(function(){
						$('.datepicker_1').datepicker({minDate: new Date(<?php echo date('Y').','.date('m').'-1,'.date('d'); ?>),
						dateFormat : 'yy-mm-dd'});
					});
				</script></td>
          </tr>
          <tr>
            <td colspan="2">&nbsp;</td>
          </tr>
          <tr>
            <td valign="top" class="main"><?php echo TEXT_BANNERS_EXPIRES_ON; ?></td>
			<td class="main">				
				<input type="text" name="expires_date" class="datepicker_2" value="<?php echo $banner->fields['expires_date_input']; ?>" />
				<script type="text/javascript">
					$(function(){
						$('.datepicker_2').datepicker({minDate: new Date(<?php echo date('Y').','.date('m').'-1,'.date('d'); ?>),
						dateFormat : 'yy-mm-dd'});
					});
				</script>
            <?php echo TEXT_BANNERS_OR_AT.'<br />'.draw_input_field('impressions', $bInfo->expires_impressions, 'maxlength="7" size="7"').' '.TEXT_BANNERS_IMPRESSIONS; ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><?php echo TEXT_BANNERS_BANNER_NOTE.'<br />'.TEXT_BANNERS_INSERT_NOTE.'<br />'.TEXT_BANNERS_EXPIRCY_NOTE.'<br />'.TEXT_BANNERS_SCHEDULE_NOTE; ?></td>
            <td class="main" align="right" valign="top" nowrap><?php echo (($form_action == 'insert') ? '<button type="submit" class="button" onclick="this.blur();">'.BUTTON_INSERT.'</button>' : '<button type="submit" class="button" onclick="this.blur();">'. BUTTON_UPDATE.'</button>'). '&nbsp;&nbsp;<a class="button" onClick="this.blur();" href="'.href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$_GET['bID']).'">'.BUTTON_CANCEL.'</a>'; ?></td>
          </tr>
        </table></td>
<?php echo'</form>'; ?>
      </tr>
<?php
  } else {
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top">
            <table width="100%"class="dataTable">
              <tr class="dataTableHeadingRow">
                <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_BANNERS; ?></td>
                <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_GROUPS; ?></td>
                <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATISTICS; ?></td>
                <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
                <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
              </tr>
<?php
    $sql = "SELECT banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from ".TABLE_BANNERS." ORDER BY banners_title, banners_group";
    $query = page_break_create($_POST['per_site'], $_GET['page'], $sql, 'banner_manager.php');
    $banners = $query['query'];
    while(!$banners->EOF) {
      $info = $db->db_query("SELECT sum(banners_shown) as banners_shown, sum(banners_clicked) as banners_clicked from ".TABLE_BANNERS_HISTORY." WHERE banners_id = '".$banners->fields['banners_id']."'");


      if (((!$_GET['bID']) || ($_GET['bID'] == $banners->fields['banners_id'])) && (!$bInfo) && (substr($_GET['action'], 0, 3) != 'new')) {
       	$bannersInfo = array_merge($banners->fields, $info->fields);
        $bInfo = new objectInfo($bannersInfo);
      }

      $banners_shown = ($info->fields['banners_shown'] != '') ? $info->fields['banners_shown'] : '0';
      $banners_clicked = ($info->fields['banners_clicked'] != '') ? $info->fields['banners_clicked'] : '0';

      if ( (is_object($bInfo)) && ($banners->fields['banners_id'] == $bInfo->banners_id) ) {
        echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'pointer\'" onclick="document.location.href=\''.href_link(FILENAME_BANNER_STATISTICS, 'page='.$_GET['page'].'&bID='.$bInfo->banners_id).'\'">'."\n";
      } else {
        echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'pointer\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\''.href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$banners->fields['banners_id']).'\'">'."\n";
      }
?>
                <td class="dataTableContent"><?php echo '<a href="javascript:popupImageWindow(\''.FILENAME_POPUP_IMAGE.'?banner='.$banners->fields['banners_id'].'\')">'.image(DIR_WS_IMAGES.'icon_popup.gif', 'View Banner').'</a>&nbsp;'.$banners->fields['banners_title']; ?></td>
                <td class="dataTableContent" align="right"><?php echo $banners->fields['banners_group']; ?></td>
                <td class="dataTableContent" align="right"><?php echo $banners_shown.' / '.$banners_clicked; ?></td>
                <td class="dataTableContent" align="right">
<?php
      if ($banners->fields['status'] == '1') {
        echo image(DIR_WS_IMAGES.'icon_status_green.gif', 'Active', 10, 10).'&nbsp;&nbsp;<a href="'.href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$banners->fields['banners_id'].'&action=setflag&flag=0').'">'.image(DIR_WS_IMAGES.'icon_status_red_light.gif', 'Set Inactive', 10, 10).'</a>';
      } else {
        echo '<a href="'.href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$banners->fields['banners_id'].'&action=setflag&flag=1').'">'.image(DIR_WS_IMAGES.'icon_status_green_light.gif', 'Set Active', 10, 10).'</a>&nbsp;&nbsp;'.image(DIR_WS_IMAGES.'icon_status_red.gif', 'Inactive', 10, 10);
      }
?></td>
                <td class="dataTableContent" align="right"><?php echo '<a href="'.href_link(FILENAME_BANNER_STATISTICS, 'page='.$_GET['page'].'&bID='.$banners->fields['banners_id']).'">'.image(DIR_WS_ICONS.'statistics.gif', ICON_STATISTICS).'</a>&nbsp;'; if ( (is_object($bInfo)) && ($banners->fields['banners_id'] == $bInfo->banners_id) ) { echo image(DIR_WS_IMAGES.'icon_arrow_right.gif', ''); } else { echo '<a href="'.href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$banners->fields['banners_id']).'">'.image(DIR_WS_IMAGES.'icon_info.gif', IMAGE_ICON_INFO).'</a>'; } ?>&nbsp;</td>
<?php
	echo '</tr>';
	$banners->MoveNext();
    }
?>

            </table>
            <table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td align="right" colspan="2"><?php echo '<a class="button" onClick="this.blur();" href="'.href_link(FILENAME_BANNER_MANAGER, 'action=new').'">'.BUTTON_NEW_BANNER.'</a>'; ?></td>
              </tr>
            </table>
            <table width="100%">
            	<tr class="page_break">
					<td class="smallText" valign="top" width="33.3%"><?php echo 'Angezeigt werden '.$query['from'].' bis '.$query['to'].' (von insgesamt '.$query['total'].' Banner)'; ?></td>
					<td class="smallText" align="center" width="33.3%"></td>
					<td class="smallText" align="right" width="33.3%">
						Banner pro Seite: <?php echo $query['page_break']->perSiteDropdown($_GET['page']); ?>
					</td>
				</tr>
				<tr><td align="center" colspan="3"><?php echo '<br />'.$query['links']; ?></td></tr>
            </table>
            </td>
<?php
  $heading = array();
  $contents = array();
  switch ($_GET['action']) {
    case 'delete':
      $heading[] = array('text' => '<b>'.$bInfo->banners_title.'</b>');

      $contents = array('form' => draw_form('banners', FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$bInfo->banners_id.'&action=deleteconfirm'));
      $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
      $contents[] = array('text' => '<br /><b>'.$bInfo->banners_title.'</b>');
      if ($bInfo->banners_image) $contents[] = array('text' => '<br />'.draw_checkbox_field('delete_image', 'on', true).' '.TEXT_INFO_DELETE_IMAGE);
      $contents[] = array('align' => 'center', 'text' => '<br /><input type="submit" class="button" onClick="this.blur();" value="'.BUTTON_DELETE.'"/>&nbsp;<a class="button" onClick="this.blur();" href="'.href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$_GET['bID']).'">'.BUTTON_CANCEL.'</a>');
      break;
    default:
      if (is_object($bInfo)) {
        $heading[] = array('text' => '<b>'.$bInfo->banners_title.'</b>');

        $contents[] = array('align' => 'center', 'text' => '<a class="button" onClick="this.blur();" href="'.href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$bInfo->banners_id.'&action=new').'">'.BUTTON_EDIT.'</a> <a class="button" onClick="this.blur();" href="'.href_link(FILENAME_BANNER_MANAGER, 'page='.$_GET['page'].'&bID='.$bInfo->banners_id.'&action=delete').'">'.BUTTON_DELETE.'</a>');
        $contents[] = array('text' => '<br />'.TEXT_BANNERS_DATE_ADDED.' '.date_short($bInfo->date_added));

        if ( (function_exists('imagecreate')) && ($dir_ok) && ($banner_extension) ) {
          $banner_id = $bInfo->banners_id;
          $days = '3';
          include(DIR_WS_INCLUDES.'graphs/banner_infobox.php');
          $contents[] = array('align' => 'center', 'text' => '<br />'.image(DIR_WS_IMAGES.'graphs/banner_infobox-'.$banner_id.'.'.$banner_extension));
        } else {
          include(DIR_WS_FUNCTIONS.'html_graphs.php');
          $contents[] = array('align' => 'center', 'text' => '<br />'.banner_graph_infoBox($bInfo->banners_id, '3'));
        }

        $contents[] = array('text' => image(DIR_WS_IMAGES.'graph_hbar_blue.gif', 'Blue', '5', '5').' '.TEXT_BANNERS_BANNER_VIEWS.'<br />'.image(DIR_WS_IMAGES.'graph_hbar_red.gif', 'Red', '5', '5').' '.TEXT_BANNERS_BANNER_CLICKS);

        if ($bInfo->date_scheduled) $contents[] = array('text' => '<br />'.sprintf(TEXT_BANNERS_SCHEDULED_AT_DATE, date_short($bInfo->date_scheduled)));

        if ($bInfo->expires_date) {
          $contents[] = array('text' => '<br />'.sprintf(TEXT_BANNERS_EXPIRES_AT_DATE, date_short($bInfo->expires_date)));
        } elseif ($bInfo->expires_impressions) {
          $contents[] = array('text' => '<br />'.sprintf(TEXT_BANNERS_EXPIRES_AT_IMPRESSIONS, $bInfo->expires_impressions));
        }

        if ($bInfo->date_status_change) $contents[] = array('text' => '<br />'.sprintf(TEXT_BANNERS_STATUS_CHANGE, date_short($bInfo->date_status_change)));
      }
      break;
  }

  if ( (not_null($heading)) && (not_null($contents)) ) {
    echo '            <td width="25%" class="border" valign="top">'."\n";

    $box = new box;
    echo $box->infoBox($heading, $contents);

    echo '            </td>'."\n";
  }
?>
          </tr>
        </table></td>
      </tr>
<?php
  }
?>
    </table></td>
  </tr>
</table>
</div>
<?php require(DIR_WS_INCLUDES.'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES.'application_bottom.php'); ?>